#ifndef MKTABLEVIEW_H
#define MKTABLEVIEW_H

#include <QTableView>
#include <QtSql/QSqlRecord>

class MKTableModel;

class MKTableView : public QTableView
{
	Q_OBJECT
public:
	MKTableView();
	bool save(QString fileName = QString());
	bool load(QString fileName = QString());

	QMap<quint8, quint32> costsForTypes();
	QMap<quint8, QMap<quint8, quint32> > costsForCategories();

signals:
	void balanceChanged(qint32);

public slots:
	bool onAddRow();
	bool onRemoveRow();

private slots:
	void onDataChanged(const QModelIndex& leftTop, const QModelIndex& rightBottom);

private:
	MKTableModel *pModel;

};

#endif // MKTABLEVIEW_H
